<template>
  <div class="comment">
    <header>
      <div><img :src="avatar" /> {{ userName }}</div>
      {{ createDate }}
    </header>
    <div class="content">{{ content }}</div>
  </div>
</template>

<script lang="ts" setup>
import dayjs from 'dayjs';

const props = defineProps({
  avatar: String,
  content: String,
  userName: String,
  createDate: Number,
});

const createDate = dayjs(props.createDate).format('YYYY-MM-DD hh:mm:ss');
</script>

<style lang="scss" scoped>
.comment {
  display: flex;
  padding: 0 20px;
  margin-top: 12px;
  flex-direction: column;

  header {
    display: flex;
    font-size: 12px;
    align-items: center;
    justify-content: space-between;

    > div {
      display: flex;
      font-size: 12px;
      align-items: center;
    }

    img {
      width: 20px;
      height: 20px;
      margin-right: 10px;
      border-radius: 50%;
    }
  }

  .content {
    margin-left: 30px;
    text-align: justify;
    word-wrap: break-word;
    color: var(--grey-color2);
  }
}
</style>
